package cn.tedu.day4;

import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * 测试类
 */
public class Test1 {
    /**
     * DI依赖注入：创建bean的时候给属性赋值
     * */
    @Test
    public void test01(){
        ApplicationContext ac=new ClassPathXmlApplicationContext("beans.xml");
        Demo d=(Demo)ac.getBean("demo");
        System.out.println(d);
        ((ClassPathXmlApplicationContext)ac).close();
    }
}